<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>第一步注册</h1>
    姓名： <input type="text" class="username" />
    <button>下一步</button>
    <script>
     let ele=document.querySelector('.username')
     if(sessionStorage.getItem('username')){
        ele.value=sessionStorage.getItem('username')
     }
     let btn=document.querySelector('button')
     btn.onclick=function(){
        let val=ele.value
        sessionStorage.setItem('username',val)
        window.location.href='./b.html'
     }
    </script>
  </body>
</html>
